package com.pattern.once.factory;

public class ConcreteCreator<T> extends Creator {

    private Class<T> c;

    @Override
    public <T extends Product> T createProduct() {

        Product product = null;
        try {
            product = (Product)Class.forName(c.getName()).newInstance();
        }catch ( Exception e){
            System.out.println("处理异常"+e);
       }
       return (T)product;
    }

    public ConcreteCreator(Class<T> c) {
        this.c = c;
    }

    public ConcreteCreator() {
    }
}
